/**
Date: 2025-08-13
Copyright (c) 2025 Industrial Software Feature Database
*/
import request from '@/utils/request';
import { AxiosPromise } from 'axios';

// 获取用户详细信息
export function getMaterialTree(){
  return request({
    url: '/material/list/tree',
    method: 'get'
  });
}
//获取金属材料下拉列表
export function getMatMaterialMenus(param){
  return request({
    url: `/material/list/dictionary/1/${param.type}?series=${param.series}`,
    method: 'get'
  });
}
//获取材料详情
export function getMatMaterialDetail(param){
  return request({
    url: `/material/list/detail/1/mat_material?series=${param}`,
    method: 'get'
  });
}

// 获取材料库模型详细
export function getMaterialDataList(data){
  return request({
    url: `/isfd/dataRetrieval/view`,
    method: 'post',
    data
  });
}

// 数据资产左侧树查询
export function getAssetTreeByDatabaseName(params) {
  return request({
    url: `/isfd/businessDatabaseRef/tree/v3`,
    method: 'get',
    params
  });
}

// 系统地图-创建地图-左侧树
export function getMapTreeBySystemId(params) {
  return request({
    url: `/isfd/businessDatabaseRef/map/tree/v3`,
    method: 'get',
    params
  });
}


// 材料库左侧树节点
export function getMaterialTreeNew(data) {
  return request({
    url: `/isfd/database/data/tree`,
    method: 'post',
    data
  });
}

// 材料库节点详细
export function getMaterialNodeInfo(data) {
  return request({
    url: `/isfd/database/data/queryOne`,
    method: 'post',
    data
  });
}

// 材料性能数据库文件下载
export function getMaterialFile(params) {
  return request({
    url: `/isfd/database/data/export/file`,
    method: 'get',
    params, 
    responseType: 'blob'
  });
}

// 编辑材料性能库节点数据
export function updateMaterialNodeData(data) {
  return request({
    url: `/isfd/database/data/updateOne`,
    method: 'post',
    data 
  }) 
}
// 材料性能库节点数据新增
export function addMaterialNodeData(data) {
  return request({
    url: `/isfd/database/data/insertOne`,
    method: 'post',
    data
  })
}

// 材料性能库节点数据删除
export function deleteMaterialNodeData(data) {
  return request({
    url: `/isfd/database/data/deleteOne`,
    method: 'delete',
    data
  })
}

// 材料性能库列表数据删除
export function deleteMaterialListData(modelId) {
  return request({
    url: `/isfd/database/data/${modelId}`,
    method: 'delete',
  }) 
}

// 数据资产不同类型数据展示
export function getAssetDataList(data) {
  return request({
    url: `/isfd/database/data/show`,
    method: 'post',
    data
  });
}
// 数据资产图片导入
export function importPicture(data) {
  return request({
    url: `/isfd/database/data/saveFile`,
    method: 'post',
    data,
    headers: { 'Content-Type': 'multipart/form-data' }
  })  
}